#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[]) {
  int pgid = atoi(argv[1]);
  printf("pid : %d, ppid : %d, pgid : %d\n", getpid(), getppid(), getpgid(0));

  if (setpgid(0, pgid) < 0) {
    perror("setpgid");
  }

  printf("pid : %d, ppid : %d, pgid : %d\n", getpid(), getppid(), getpgid(0));

  return 0;
}
